<template>
  <div class="bet-list">
    <template v-if="isNeedCollapse(renderList)">
      <BetCollapse :list="renderList" />
    </template>

    <template v-else>
      <BetNormal :list="renderList" />
    </template>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import BetCollapse from './betCollapse.vue'
import BetNormal from './betNormal.vue'

type Props = {
  list: {
    lotteryPlayTypeList: any[]
  }
}

const props = defineProps<Props>()

const renderList = computed(() => {
  if (props.list.lotteryPlayTypeList) return props.list.lotteryPlayTypeList

  return [props.list]
})

const isNeedCollapse = (list) => {
  if (list?.[0]?.lotteryCode === 'JNDSSC' && list?.[0]?.playTypeCode === 'WANW') return true

  return false
}
</script>

<style lang="less" scoped>
.bet-list {
  width: 100%;
}
</style>
